/*
 * Copyright (c) 2012 Tomas Shestakov. <http://code.google.com/p/jmmo/>
 */

package jmmo.engine.property

/**
 * The root of "speaking" observables (can has listeners).
 * Has two useful inheritors:
 * [[jmmo.engine.property.Property]] and
 * [[jmmo.engine.property.ObservableContainer]]
 * <p>
 * The Observer is the class which changes can be observed.
 * </p>
 * @author Tomas Shestakov
 */
trait Observable extends SilentObservable with ChangeListeners {

  /**
   * Returns a `SilentObservable` with same id, attributes an content as this observable.
   * @param filter a predicate which gets `Observable` and returns true if `Observable` pass the filter false otherwise.
   * @return `SilentObservable` with same content as this (Serializable and immutable recommended).
   */
  def serializedCopy(filter: Identifiable.Filter = Identifiable.passAll): SerializedObservable
}

//object Observable {
//
//  /**
//   * Type of observable filter.
//   */
//  type Filter = (Observable) => Boolean
//
//  /**
//   * Filter which pass all observables
//   */
//  val passAll = (_: Observable) => true
//}